<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">  
<html xmlns="http://www.w3.org/1999/xhtml"  
      xmlns:h="http://java.sun.com/jsf/html"  
      xmlns:f="http://java.sun.com/jsf/core"  
      xmlns:ui="http://java.sun.com/jsf/facelets"  
      xmlns:p="http://primefaces.org/ui">  
  
<h:head>  
	<title>Cadastro_redacao</title>  
  
</h:head>  
  
<h:body>
    	<h:graphicImage url="imagens/logo.png" style="float:left; "/>
 		<h:form id="formLogin">  
		    <h:outputLink id="loginLink" value="javascript:void(0)" onclick="PF('dlg').show()" title="Logar">   
		        <p:graphicImage value="/imagens/login.png" width="40" height="40" style="float:right;" />  
		    </h:outputLink>  
		  	<h:outputLink id="registerLink" value="cadPessoa.jsf" title="Registrar">   
		        <p:graphicImage value="/imagens/register.png" width="40" height="40" style="float:right;" />  
		    </h:outputLink>
		    
		    <p:growl id="growl" showDetail="true" life="3000" />  
		  
		    <p:dialog id="dialog" header="Login" widgetVar="dlg" resizable="false" style="background-color:#F3F3F3;">  
		  
		        <h:panelGrid columns="2" cellpadding="5">  
		        <h:outputLabel for="email" value="E-Mail:" />  
		        <p:inputText value="#{loginBean.email}"   
		                    id="email" required="true" label="email" />  
		              
		        <h:outputLabel for="password" value="Password:" />  
		        <h:inputSecret value="#{loginBean.password}"   
		                    id="password" required="true" label="password" />  
		              
		     	<f:facet name="footer">  
		        	<p:commandButton id="loginButton" value="Login" update="growl"   
		                    actionListener="#{loginBean.login}"   
		                    oncomplete="handleLoginRequest(xhr, status, args)"/>  
		    	</f:facet>  
			</h:panelGrid>  
		          
		</p:dialog>  
	</h:form> 

	<script type="text/javascript">  
		function handleLoginRequest(xhr, status, args) {  
			if(args.validationFailed || !args.loggedIn) {  
		            PF('dlg').jq.effect("shake", { times:5 }, 100);  
		    }   
		    else {  
		    	PF('dlg').hide();  
		        $('#loginLink').fadeOut();  
		    }  
		}  
	</script>  
	
	<h:form id="pesAnuncio" >
		<h:commandLink action="/pesAnuncio.jsf" style="float:right; margin-top: 90px;">
			<h:outputText styleClass="ui-icon ui-icon-search" style="margin:0 auto;" /> 
		</h:commandLink>
		<p:inputText value="#{pesAnuncioBean.titulo}" style="float:right; margin-top: 90px;;" />
	</h:form>  
</h:body>  
</html>  